//
//  ActivityViewCell.m
//  DaiShengInvest
//
//  Created by 张睿 on 2017/8/16.
//  Copyright © 2017年 davinci. All rights reserved.
//

#import "ActivityViewCell.h"
#import "ActivityModel.h"

@interface ActivityViewCell ()

@property (nonatomic, weak)UIImageView * backImageView;



@end

@implementation ActivityViewCell



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self setupUI];
    }
    
    return self;
}



- (void)setupUI{
    
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.backgroundColor = [UIColor clearColor];
    
    UIView * topView = [UIView new];
    topView.backgroundColor = [UIColor clearColor];
    
    [self.contentView addSubview:topView];
    
    [topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.leading.trailing.mas_equalTo(self.contentView);
        make.height.mas_equalTo(10 * SCREENH6);
    }];
    
    UIImageView * imageView = [UIImageView new];
    imageView.contentMode = UIViewContentModeScaleToFill;
    
    self.backImageView = imageView;
    
    [self.contentView addSubview:self.backImageView];
    
    [self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.leading.trailing.mas_equalTo(self.contentView);
        make.top.mas_equalTo(topView.mas_bottom);
    }];
    
    
    
}


- (void)setModel:(ActivityModel *)model{
    
    _model = model;
    
    NSURL * imageUrl = [[NSURL alloc] initWithString:model.icon];
    
    [self.backImageView sd_setImageWithURL:imageUrl];
    

    
    self.ID = [NSString stringWithFormat:@"%@",model.ID];
    
//    NSString * type = [NSString stringWithFormat:@"%@",model.type];
    
//    if ([type isEqualToString:@"0"]) {
//        //富文本
//        
//    }else{
//        //h5
//        NSString * urlString = [NSString stringWithFormat:@"%@",model.url];
//        NSString * url = [[NSURL alloc] initWithString:urlString];
////        NSLog(@"url==%@",url);
//    }
    
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
